<?php
//后台登陆控制
include_once('admin_global.php');
$db->Get_user_shell_check($uid, $shell);   //检测用户是否登录
$db->Get_user_type_check($uid, $shell);    //检测用户权限
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>网站信息配置</title>
    <link rel="stylesheet" href="css/right.css" type="text/css" />
</head>
<?php
//读取配置信息
$sql = "SELECT * FROM config";
$query = $db->query($sql);
while ($row = $db->fetch_array($query)) {
    $data[$row['cfgName']] = $row['cfgContent'];
}

//修改配置信息
if (isset($_POST['siteConfig'])) {
    unset($_POST['siteConfig']);              //删除steConifg变量
    //对$_POST数组中的元素进行循环,逐个修改p_config数据表中每条记录的内容
    foreach ($_POST as $cfgName => $cfgContent) {
        $sql="UPDATE config SET cfgContent='$cfgContent' WHERE cfgName='$cfgName'";
        $query=$db->query($sql);
    }
    echo "<script>window.location.href='siteConfig.php'</script>";
}
?>
<body>
<div id="right_main">
    <div class="right_content">
        <div class="right_top_menu">
            <h3>
                您当前的位置：后台 > 基本设置 > 网站信息配置
            </h3>
        </div>
        <div class="right_center_content">
            <form id="form1" method="post" action="">
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td valign="top" >
                            <div class="txl_search"></div>
                            <table cellpadding="0" cellspacing="0" border="0" width="100%"  class="sy_table">
                                <tr>
                                    <th colspan="2" >网站信息配置</th>
                                </tr>
                                <tr>
                                    <td width="35%" align="right">网站名称：</td>
                                    <td width="65%"><input type="text" name="websitename"  class="int_text" value="<?php echo $data['websitename'];?>" size="60" /></td>
                                </tr>
                                <tr>
                                    <td width="35%" align="right">网站地址：</td>
                                    <td width="65%"><input type="text" name="websiteurl"  class="int_text" value="<?php echo $data['websiteurl'];?>" size="60" /></td>
                                </tr>
                                <tr>
                                    <td width="35%" align="right">网站关键字：</td>
                                    <td width="65%"><input type="text" name="keyword"  class="int_text" value="<?php echo $data['keyword'];?>" size="60" /></td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center" height='30'>
                                        <input type="submit" class="btn_ipt01" name="siteConfig" value=" 保存设置 "/>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
</body>
</html>
